#ifndef _LIGHT_H
#define _LIGHT_H

#include <fstream>
#include <string>
#include <math.h>
#include <GL/glew.h>
#include "IDrawable.h"
#include "Export.h"
#include "Color4.h"
#include "Vector3.h"

namespace glow
{
  class SHARED Light : public IDrawable
  {
  private :


    /**
     *AMBIENT - light that comes from all directions equally and is scattered in all directions equally by the polygons in your scene. This isn't quite true of the real world - but it's a good first approximation for light that comes pretty much uniformly from the sky and arrives onto a surface by bouncing off so many other surfaces that it might as well be uniform.
     **/
     GLfloat Light_Ambient[4];

    /**
     *  DIFFUSE - light that comes from a particular point source (like the Sun) and hits surfaces with an intensity that depends on whether they face towards the light or away from it. However, once the light radiates from the surface, it does so equally in all directions. It is diffuse lighting that best defines the shape of 3D objects.
     **/
    GLfloat Light_Diffuse[4];

    /**
     *  SPECULAR - as with diffuse lighting, the light comes from a point souce, but with specular lighting, it is reflected more in the manner of a mirror where most of the light bounces off in a particular direction defined by the surface shape. Specular lighting is what produces the shiney highlights and helps us to distinguish between flat, dull surfaces such as plaster and shiney surfaces like polished plastics and metals.
     **/
    GLfloat Light_Specular[4];

    /**
     *  Position of the light
     **/
    GLfloat Light_Position[4];

    /**
     *  Number of the light you to create
     **/
    GLenum NumLight;

  public :

    /**
     *  Constructor of Light
	 *\param NumLight the GLenum of LIGHT
     **/
    Light(GLenum NumLight = GL_LIGHT0);

    /**
     *  Activate the Light
     **/
    void on() const;

    /**
     *  Desactivate the Light
     **/
    void off() const;

    /**
     *  Set the parameter in Ambiant of the Light
	 *\param color the color of the ambiant light
     **/
    void setAmbient(const Color4f &color);

    /**
     *  Set the parameter in Diffuse of the Light
	 *\param color the color of the diffuse light
     **/
    void setDiffuse(const Color4f &color);

    /**
     *  Set the parameter in Specular light of the Light
	 *\param color the color of the specular light
     **/
    void setSpecular(const Color4f &color);

    /**
     *  Set the position of the Light
     *\param position the position of the light
	 *\param infinit 1.0 if the light is locate. All other value set the infinite light
     **/
    void setPosition(const Vector3f &position, int infinit = 1.0);

    /**
     *  Draw a sphere around the light
     **/
    virtual void draw() const;

  };
}

#endif
